package frame;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.UIManager;

import frame.networks.NetworksPanel;
import frame.options.Options;
import frame.options.simulator.Simulator;

@SuppressWarnings("serial")
public class MopraFrame extends JFrame
{
	private Simulator simulator;
	public Simulator getSimulator(){ return simulator; }
	public void setSimulator( Simulator simulator ){ this.simulator = simulator; }
	
	private Options options;
	public Options getOptions(){ return options; }
	public void setOptions( Options options ){ this.options = options; }
	
	private NetworksPanel networksPanel;
	public NetworksPanel getNetworksPanel(){ return networksPanel; }
	public void setNetworksPanel( NetworksPanel networksPanel ){ this.networksPanel = networksPanel; }
	
	public MopraFrame()
	{
		try
		{
			UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
		}
		catch( Exception exception )
		{
			System.out.println( "Error setting native LAF: " + exception );
		}
		
		this.setSimulator( new Simulator() );
		this.setOptions( new Options( this ) );
		this.setNetworksPanel( new NetworksPanel( this ) );
		
		this.setIconImage( ( new ImageIcon( this.getClass().getResource( "/icons/upcSmall.png" ) ) ).getImage() );
		this.setTitle( "MOPRA" );
		this.setSize( 900, 600 );
		this.setExtendedState( JFrame.MAXIMIZED_BOTH );
		this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		this.setJMenuBar( this.getOptions() );
		this.setContentPane( this.getNetworksPanel() );
		this.setLocationRelativeTo( null );
	}
}
